var child;
var isRed;
/**
 * layui主体代码
 */
layui.use(['form', 'laydate'], function () {
    var form = layui.form,
        layer = layui.layer,
        $ = layui.$,
        laydate = layui.laydate;

    /**
     * 监听提交
     */
    form.on('submit(saveBtn)', function (result) {
        child = result.field;
        let data = result.field;


        console.log(data);
        $.post("student/add",{
            className:data.className,
            address: data.address,
            birthday:data.birthday,
            email: data.email,
            gender: $("#gender").val() == "女" ? 1 :0 ,
            idcard:data.idcard,
            phone:data.phone,
            qq:data.qq,
            stuname:data.stuName,
            createtime: data.goSchool.toString()


        },function (result) {
            close(result);
        })

        return false;
    });
    /**
     * 时间选择框样式
     */
    laydate.render({
        elem: '#begin'
        , theme: '#393D49'
    });

    laydate.render({
        elem: '#createTime'
        , theme: '#393D49'
    });
});
/**
 * 子向父传值方法
 * @param result
 */
function close(result) {
    parent.addReload(result);
    var index = parent.layer.getFrameIndex(window.name);
    parent.layer.close(index);
}

